﻿<%@ Page Language="C#" MasterPageFile="~/ad/AdminFShop.master" AutoEventWireup="true" CodeFile="ManageCategory.aspx.cs" Inherits="ManageCategory" Title="List Category" %>

<%@ Register assembly="DevExpress.Web.ASPxEditors.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <table border="0" cellpadding="0" cellspacing="0" width="100%">
	<!--Start add new-->
	<tr  style="width:100%;">
	   <td align="right" 
            style="padding: 10px; height: 21px; text-align: center; font-family: TAhoma; font-size: 20px; background-color: #808080; color: #FFFFFF;" 
            id="Tieude">	        	    
	       QUẢN LÝ DANH MỤC</td>        
	</tr>
	<!--End add new-->
	<!--Start add new-->
	<tr  style="width:100%;">
	   <td align="left" style="height: 25px" valign="middle">	        	    
		   <br />
           <table style="width: 100%">
               <tr>
                   <td style="height: 29px">
                   </td>
                   <td align="right" style="height: 29px; width: 389px">
                       <dx:ASPxLabel ID="ASPxLabel1" runat="server" Text="Tên danh mục cha : ">
                       </dx:ASPxLabel>
                       <asp:DropDownList ID="ddlCategory" runat="server" 
		  Width="138px" 
		  OnSelectedIndexChanged="ddlCategory_SelectedIndexChanged"
		  AutoPostBack="True" DataSourceID="SqlDataSource1" DataTextField="Menu" DataValueField="IDMenu"></asp:DropDownList>
		               <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                           ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                           SelectCommand="SELECT * FROM [MENU]"></asp:SqlDataSource>
		           </td>
                   <td style="height: 29px" width="100">
                       <dx:ASPxButton ID="btnSearch" runat="server" Text="Hiển thị tất cả" 
                           onclick="btnSearch_Click1">
                       </dx:ASPxButton>
                   </td>
               </tr>
           </table>
           
	   </td>        
	</tr>
	<!--End add new-->
	<tr>
		<td valign="top" style="width:100%;" >
		<asp:GridView ID="grdCategory" runat="server" AllowPaging="True" 
			AutoGenerateColumns="False" DataKeyNames="Cate_ID" Width="100%"
			ForeColor="Black" BorderStyle="None" BorderWidth="1px" PageSize="15"
			CellPadding="4" GridLines="Vertical" OnRowDataBound="grdCategory_RowDataBound" 
			OnPageIndexChanging="grdCategory_PageIndexChanging" 
                OnRowCommand="grdCategory_RowCommand" AllowSorting="True" BackColor="White" 
                BorderColor="#DEDFDE">
			<Columns>        
				 <asp:TemplateField>
					<ItemStyle HorizontalAlign="Center" />
					<ItemTemplate>
						<asp:CheckBox ID="chkCheck" runat="server" />                               
					</ItemTemplate>
				</asp:TemplateField> 
				<asp:TemplateField HeaderText="ID">            
					<ItemStyle Width="5%" />
					<ItemTemplate>
						<asp:Label ID="Cate_ID" runat="Server" Text='<%#Eval("Cate_ID") %>' ></asp:Label>
					</ItemTemplate>
				</asp:TemplateField>
				 <asp:TemplateField HeaderText="T&#234;n danh mục">            
					<ItemStyle Width="45%"/>
					<ItemTemplate>
					    <a href='<%# "EditCategory.aspx?Category_ID=" + Eval("Cate_ID") %>'>
						    <asp:Label ID="Category_Cate_ParentID" runat="Server" Text='<%#Eval("Cate_Name") %>' ></asp:Label>
						</a>
					</ItemTemplate>
				</asp:TemplateField>  			     
					
				<asp:TemplateField  HeaderText="Hiển thị">
					<ItemStyle HorizontalAlign="Center" />
					<ItemTemplate>
						<asp:ImageButton ID="btnActive" 
						CommandArgument='<%# Eval("Cate_ID") %>' 
						CommandName="active_Category"  ImageUrl="Images/check.gif" 
						runat="server" OnClientClick = "javascript:return confirm('Bạn có chắc chắn không ?');"/></a>                            
					</ItemTemplate>
				</asp:TemplateField>     
				          
				<asp:TemplateField >
					<HeaderTemplate>
					<asp:Label ID="Label3" runat="server" Text="Chức năng" ></asp:Label>                   
					</HeaderTemplate>
					<ItemTemplate>                                
						<asp:HyperLink ID="lnkEdit" runat="server" Font-Bold="True" 
                            NavigateUrl='<%# "EditCategory.aspx?Category_ID=" + Eval("Cate_ID") %>' 
                            Height="19px" ImageUrl="~/images/ico/hieuchinh.jpg" Width="75px">
							<asp:Image ID="ImageEdit" ToolTip="Sửa thông tin" runat="server" ImageUrl="Images/edit.gif" />
                            
						</asp:HyperLink>   
						                       
						 <asp:ImageButton ID="btnDelete" CommandArgument='<%# Eval("Cate_ID") %>' 
                            CommandName="delete_Category"  ImageUrl="~/images/ico/xoa.jpg" runat="server"  
						 OnClientClick = "javascript:return confirm('Bạn có chắc chắn không ?');" Height="19px" 
                            Width="75px" />
						                            
						 
					</ItemTemplate>
					<ItemStyle Wrap="False" Width="160px" />
				</asp:TemplateField>
			</Columns>      
			<PagerSettings FirstPageText="Trang đầu" LastPageText="Trang cuối" NextPageText="&gt;&gt;"
			  PageButtonCount="5" PreviousPageText="&lt;&lt;"/>     
			<pagerstyle backcolor="#F7F7DE" forecolor="Black" horizontalalign="Right" />
			<RowStyle BorderColor="Black" BorderWidth="1px" BackColor="#F7F7DE" />
			<FooterStyle BackColor="#CCCC99" />
			<selectedrowstyle backcolor="#CE5D5A" font-bold="True" forecolor="White" />
			<headerstyle backcolor="#6B696B" font-bold="True" forecolor="White" />
			<alternatingrowstyle backcolor="White" />
		    <SortedAscendingCellStyle BackColor="#FBFBF2" />
            <SortedAscendingHeaderStyle BackColor="#848384" />
            <SortedDescendingCellStyle BackColor="#EAEAD3" />
            <SortedDescendingHeaderStyle BackColor="#575357" />
		</asp:GridView>
		</td>
	</tr>
<!--Start button-->
 <tr  style="width:100%;">
        <td align="right">
			<br />
        </td>        
  </tr>
<!--End button-->  
 <tr  style="width:100%;">
        <td align="right">
			<table align="left" style="width: 100%; float: left">
                <tr>
                    <td style="height: 23px; width: 80px;" align="left">
                        <dx:ASPxHyperLink ID="ASPxHyperLink2" runat="server" Text="Thêm mới" 
                            CssClass="dxeButtonEditButton" 
                            NavigateUrl="~/ad/EditCategory.aspx" Width="80px"  />

                    </td>
                    <td align="left" width="80" style="height: 23px">
                        <dx:ASPxHyperLink ID="ASPxHyperLink3" runat="server" Text="Chọn hết" 
                            onclick="CheckAll();" CssClass="dxeButtonEditButton" Width="80px" />

                    </td>
                    <td align="left" width="80" style="height: 23px">
                        <dx:ASPxHyperLink ID="ASPxHyperLink1" runat="server" Text="Bỏ chọn hết" 
                            onclick="UnCheckAll();" CssClass="dxeButtonEditButton" Width="80px" />
                          
                    </td>
                    <td align="left" style="height: 23px; width: 261px;">
                        <asp:LinkButton ID="btnDeleteAll" runat="server" OnClick="btnDeleteAll_Click" 
			OnClientClick= "javascript:return confirm('Bạn có chắc chắn không ?');" CssClass="dxeButtonEditButton" 
                            Width="80px" >Xóa hết</asp:LinkButton>
                          
                    </td>
                    <td style="height: 23px">
                    </td>
                </tr>
            </table>
        </td>        
  </tr>
</table>
<script language="javascript" type="text/javascript">        
        function CheckAll()
        {            
            for(i=0;i<document.getElementsByTagName("input").length;i++)
            {
                if(document.getElementsByTagName("input")[i].type == "checkbox")
                {
                    document.getElementsByTagName("input")[i].checked = true;                   
                }
            }
            return true;
        }
        
        function UnCheckAll()
        {            
            for(i=0;i<document.getElementsByTagName("input").length;i++)
            {
                if(document.getElementsByTagName("input")[i].type == "checkbox")
                {
                    document.getElementsByTagName("input")[i].checked = false;                   
                }
            }
            return true;
        }
    </script>
</asp:Content>


